package com.chenyuxin.ilp.security.auth.sms;

import com.chenyuxin.ilp.model.vo.user.UserLoginVo;
import lombok.Setter;
import org.springframework.security.authentication.AbstractAuthenticationToken;

@Setter
public class SmsAuthentication extends AbstractAuthenticationToken {
    private String phone;
    private String code;
    private UserLoginVo currentUser;

    public SmsAuthentication() {
        // 权限，用不上，直接null
        super(null);
    }

    @Override
    public Object getCredentials() {
        return isAuthenticated()?null:code;
    }

    @Override
    public Object getPrincipal() {
        return isAuthenticated()?currentUser:phone;
    }
}
